<?php

namespace App\Http\Middleware;

use App\Services\Message\ApiAuthService;
use Closure;

class ApiMiddleware
{
    /**
     * @var ApiAuthService
     */
    protected $service;

    public function __construct(ApiAuthService $service)
    {
        $this->service = $service;
    }

    /**
     * @param $request
     * @param Closure $next
     * @return mixed
     * @throws \Exception
     */
    public function handle($request, Closure $next)
    {
        $this->service->verify($request->all(),$request->header());
//        $request->except(['secret_id','timestamp','sign']);
        return $next($request);
    }
}

